package com.bytic.miaosha.service.impl;

import com.bytic.miaosha.mapper.GoodsMapper;
import com.bytic.miaosha.service.GoodsService;
import com.bytic.miaosha.vo.GoodsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List<GoodsVO> listGoodsVo() {
        List<GoodsVO> goodsVOS = goodsMapper.listGoodsVo();
        return goodsVOS;
    }

    @Override
    public GoodsVO getGoodsVoByGoodsId(long goodsid) {
        return goodsMapper.getGoodsVoByGoodsId(goodsid);
    }

    @Override
    public boolean reduceStock(Long goodsId) {
        int ret = goodsMapper.reduceStock(goodsId);
        return ret > 0;
    }
}
